
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_EBAS_FAG_EBAS_KARAKTER_SKALA]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[EBAS_FAG] DROP CONSTRAINT FK_EBAS_FAG_EBAS_KARAKTER_SKALA
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EBAS_KARAKTER_SKALA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[EBAS_KARAKTER_SKALA]
GO

CREATE TABLE [dbo].[EBAS_KARAKTER_SKALA] (
	[GUID] [uniqueidentifier] ROWGUIDCOL NOT NULL ,
	[NAVN] [varchar] (50) COLLATE Danish_Norwegian_CI_AS NOT NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[EBAS_KARAKTER_SKALA] WITH NOCHECK ADD 
	CONSTRAINT [PK_EBAS_KARAKTER_SKALA] PRIMARY KEY  CLUSTERED 
	(
		[GUID]
	)  ON [PRIMARY] 
GO

INSERT INTO EBAS_KARAKTER_SKALA (GUID, NAVN) VALUES (NEWID(), '13-skala')
INSERT INTO EBAS_KARAKTER_SKALA (GUID, NAVN) VALUES (NEWID(), 'US-skala')
INSERT INTO EBAS_KARAKTER_SKALA (GUID, NAVN) VALUES (NEWID(), '7-skala')
GO